
LIB = -lpthread
FLAGS = -g -pg -std=c++0x

all: server

server: http_conn.o main.o forward_conn.o abstract_conn.o util.o def.o
	g++ $(FLAGS) main.o http_conn.o forward_conn.o abstract_conn.o util.o def.o -o server $(LIB)

abstract_conn.o: abstract_conn.h def.h
	g++ $(FLAGS) -c abstract_conn.cpp -o abstract_conn.o $(LIB)
	
util.o: util.h def.h
	g++ $(FLAGS) -c util.cpp -o util.o $(LIB)
	
def.o:  def.h
	g++ $(FLAGS) -c def.cpp -o def.o $(LIB)
	
http_conn.o: http_conn.h locker.h threadpool.h abstract_conn.h util.h
	g++ $(FLAGS) -c http_conn.cpp -o http_conn.o $(LIB)
	
forward_conn.o: forward_conn.h locker.h threadpool.h abstract_conn.h
	g++ $(FLAGS) -c forward_conn.cpp -o forward_conn.o $(LIB)
	
main.o: http_conn.h threadpool.h locker.h thread_arg.h link_queue.h def.h abstract_conn.h
	g++ $(FLAGS) -c main.cpp -o main.o $(LIB)
	
testserver: testserver.cpp
	g++ $(FLAGS) testserver.cpp -o testserver $(LIB)
	
testserver_get: testserver_get.cpp
	g++ $(FLAGS) testserver_get.cpp -o testserver_get $(LIB)

clean: 
	rm *.o
	rm server
